package com.imachen.ymcc.fallback;

import com.imachen.ymcc.enums.GlobalExceptionCode;
import com.imachen.ymcc.fegin.CourseMarketFeignClien;
import com.imachen.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseMarketFeignClienFallbackFactory implements FallbackFactory<CourseMarketFeignClien> {
    @Override
    public CourseMarketFeignClien create(Throwable throwable) {
        return new CourseMarketFeignClien() {
            @Override
            public JSONResult get(Long id) {
                return JSONResult.error(GlobalExceptionCode.SERVICE_ERROR);
            }
        };
    }
}
